import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
import { SMyRole } from "./SMyRole";
//class SeqMyRoleHelper

export class SeqMyRoleHelper {
  public static write(stream: SerializeStream, myroles: Array<SMyRole>): void {
    if (myroles) {
      stream.writeSize(myroles.length);
      let i = 0;
      while (i < myroles.length) {
        myroles[i].__write(stream);
        ++i;
      }
    } else {
      stream.writeSize(0);
    }
    return;
  }

  public static read(stream: SerializeStream): Array<SMyRole> {
    var size = stream.readSize();
    stream.startSeq(size, 37);
    var ret = new Array<any>();
    var i = 0;
    while (i < size) {
      let loc4 = new SMyRole()
      loc4.__read(stream);
      ret[i] = loc4;
      stream.checkSeq();
      stream.endElement();
      ++i;
    }
    stream.endSeq(size);
    return ret;
  }
}
